import java.math.BigInteger;
import java.util.*;

public class Main {

    class Fenwick{

        int[] tree;
        int n;
        public Fenwick(int[] nums){
            this.n = nums.length;
            this.tree = new int[n+1];
            for(int i=1;i<=n;i++){
                add(i,nums[i-1]);
                int next = lowBit(i)+i;
                if(next<=n){
                    add(next,tree[i]);
                }
            }
        }

        private int lowBit(int n){
            return n&-n;
        }

        public void update(int index,int value){
            for(int i=index;i<=n;i+=lowBit(i)){
                this.tree[i]+=value;
            }
        }

        public int query(int index){
            int ans = 0;
            while(index>=1){
                ans+=tree[index];
                index-=lowBit(index);
            }
            return ans;
        }

        public void add(int index,int value){
            this.tree[index]+=value;
        }
    }


    class UniondFind{
        int[] root;
        UniondFind(int n){
            root = new int[n];
            for(int i=0;i<n;i++){
                root[i] = i;
            }
        }

        public void union(int x,int y){
            if(x>y){
                union(y,x);
            }
            int rootX = find(x);
            int rootY = find(y);
            root[rootY] = rootX;
        }

        public int find(int x){
            if(x == root[x]){
                return x;
            }
            root[x] = find(root[x]);
            return root[x];
        }
    }

    public static void in(int[] arr,int n,Scanner scanner){
        for(int i=0;i<n;i++){
            arr[i] = scanner.nextInt();
        }
    }


    public static void main(String[] args) {
        long a = 20250412L;
        long b = 20240413L;
//        long n = 409876661809331L;
        // 令 n+a = x   (n+a)%b == 0 等价于 x % b == 0 x从b 2b 3b开始枚举，也就是 n+a = kb k=1,2,3
        // (n+b)%a == 0就变成了（kb-a+b）%a
        long k = 1;
        while(true){
            if((k*b-a+b)%a==0){
                System.out.println(k*b-a);
                break;
            }
            k++;
        }
    }
}
